<html>
<head><meta charset="utf-8"><title>u32 -&gt; Mask16&lt;32&gt; · project-portable-simd · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/index.html">project-portable-simd</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html">u32 -&gt; Mask16&lt;32&gt;</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="242411562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/242411562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brandon Falk <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#242411562">(Jun 11 2021 at 22:30)</a>:</h4>
<p>I might have just barely missed it somewhere in the docs, is there a way to convert from an int to a mask?</p>



<a name="242411958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/242411958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Miguel Raz Guzmán Macedo <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#242411958">(Jun 11 2021 at 22:38)</a>:</h4>
<p>Splat to a vector, then to a mask?</p>



<a name="242412026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/242412026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#242412026">(Jun 11 2021 at 22:38)</a>:</h4>
<p>every Mask type like MaskSize should have <code>from_int</code>.</p>



<a name="242412041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/242412041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#242412041">(Jun 11 2021 at 22:39)</a>:</h4>
<p>...unless you mean int-as-bitmask.</p>



<a name="242412582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/242412582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brandon Falk <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#242412582">(Jun 11 2021 at 22:48)</a>:</h4>
<p>I guess I mean like 0x5u32 -&gt; [true, false, true], not a vector of ints</p>



<a name="242412762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/242412762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#242412762">(Jun 11 2021 at 22:51)</a>:</h4>
<p>Looks like no.</p>



<a name="242414487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/242414487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#242414487">(Jun 11 2021 at 23:20)</a>:</h4>
<p>Hmm that should actually be relatively easy to implement.  I'm not sure why I missed it, I'm going to look into it</p>



<a name="242417952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/242417952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brandon Falk <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#242417952">(Jun 12 2021 at 00:36)</a>:</h4>
<p>That'd be sweet. Would help a lot with doing some mask math, which I often do on avx512 to transform them</p>



<a name="242417957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/242417957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brandon Falk <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#242417957">(Jun 12 2021 at 00:36)</a>:</h4>
<p>Also just kinda nice to be able to do 0b1011011011 syntax instead of [true, false, true, true, false, true, true, false, true, true]</p>



<a name="242418322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/242418322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#242418322">(Jun 12 2021 at 00:46)</a>:</h4>
<p>I opened a PR (<a href="https://github.com/rust-lang/stdsimd/issues/136">stdsimd#136</a>)</p>



<a name="242418334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/242418334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#242418334">(Jun 12 2021 at 00:47)</a>:</h4>
<p>Unfortunately you can't use integers directly, you must use byte arrays, so you'll need to use <code>to_ne_bytes</code> etc</p>



<a name="243445966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/u32%20-%3E%20Mask16%3C32%3E/near/243445966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/u32.20-.3E.20Mask16.3C32.3E.html#243445966">(Jun 21 2021 at 21:31)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/136">#136</a> was merged, sorry for the delay!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>